import React from 'react';
import '../static/main.css';
import * as request from '../utils/request';

//左侧问答
class Chat extends React.Component{
  constructor(props){
    super(props)
    this.state={
      //聊天内容列表
      items:[],
      //待发送内容
      sendText:''
    }
  }

  componentDidMount(){
    request.post('api/qa/searcher', {"content":"行业研报中传感器及激光雷达出现了多少次"}).then(res => {
        console.log(res);
    })
  }

  handleChange = (event) => {
    let val = event.target.value
    // console.log(val)
    this.setState({sendText: val});
  }
  sendContent=()=>{
    console.log(111)
  }
  render () {
    return (
      <div id="col-l">
        <div className="col-l-t">
          <div className="content">
            <div className="bubble" id="Chat">

              <div className="msg clearfix">
                <span className="triangle"></span>
                <div className="article"> 
                  <p>您好，我是小粤。</p><p>欢迎使用粤建网智能知识库。您可以在这里咨询“信息和技术应用服务”、“三库一平台”等各种问题。</p>
                  <div className="ana-detail mbtn">
                      <span onClick={()=>{this.props.setPage('search')}}>详情</span>
                  </div>
                </div>
              </div>
              
              <div className="msg fr">
                <span className="triangle right"></span><div className="article">中国智能制造现状</div>
              </div>
              {/* 解析结果 */}
              <div className="ana-result">
                <div className="ana-item">
                  <div className="ana-head">
                    <span className="snote">解析结果：</span>
                    <span className="sbnt mbtn">查数据</span>
                  </div>
                  <div className="ana-content">
                      <div className="ana-list">
                        <span className="tag">实体</span>
                        <span className="tag-value entity">万科</span>
                      </div>

                      <div className="ana-list">
                        <span className="tag">属性</span>
                        <span className="tag-value attr"><em>营业情况</em></span>
                      </div>

                      <div className="ana-list">
                        <span className="tag">属性</span>
                        <span className="tag-value attr"><em>营业情况</em></span>
                      </div>
                  </div>
                  <div className="ana-detail mbtn">
                    <span onClick={()=>{this.props.setPage('parser')}}>详情</span>
                  </div>
                </div>
              </div>
              {/* 解析结果end */}

              <div className="msg clearfix">
                <span className="triangle"></span>
                <div className="article"> 
                  <p>您好，我是小粤。</p><p>欢迎使用粤建网智能知识库。您可以在这里咨询“信息和技术应用服务”、“三库一平台”等各种问题。</p>
                  <div className="ana-detail mbtn"><span>详情</span></div>
                </div>
              </div>
              
            </div>
          </div>
        </div>
        <div className="col-l-b">
          <div className="faq-input-content">
            <div className="cite"><span className="cut">引用：万科近五年营业情况</span><em className="close-btn">×</em></div>
            <textarea name="textfield" className="input" id="faqInput" placeholder="请输入..." autoComplete="off" onChange={(e)=>{this.handleChange(e)}}></textarea>
            <input type="button" className="btn mbtn" value="发送" onClick={this.sendContent} />
            <div className="input-count"><span id="textCount"></span></div>
          </div>
        </div>
      </div>
    );
  }
}

export default Chat